package sessionBeanTest;


import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import entityBean.*;
import interfaceBeanRemote.sessionAvancementRemote;
import interfaceBeanRemote.sessionClubRemote;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.persistence.EntityManager;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import entityBean.Avancement;
import entityBean.Club;
/*
 
 public interface sessionAvancementRemote {

	void addAvancement(Avancement avancement);

	void flush();

	void refresh(Avancement av);

 */
public class AvancementTest {
	Context ctx4;
	sessionAvancementRemote Avancementbean;
	EntityManager em;
	@Before
	public void setUp() throws Exception {
		ctx4= new InitialContext();

		ctx4.addToEnvironment(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
		ctx4.addToEnvironment(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
		ctx4.addToEnvironment(InitialContext.PROVIDER_URL,"jnp://localhost:1099");
		Avancementbean=(sessionAvancementRemote) ctx4.lookup("sessionAvancement/remote");
		
		
	}

	@After
	public void tearDown() throws Exception {
		
		
		
	}
	
	@Test
	public void testAddAvancement(){
		
	Avancement avancement=new Avancement();
	avancement.setStadeAvancement("avancement");
	
	Avancementbean.addAvancement(avancement);
	
	//Avancement avancement2 = em.find(Avancement.class, 1);
	
	//assertEquals("avancement",avancement2.getStadeAvancement());
	 }

}
